/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package projecteuler;
import java.math.BigInteger;
/**
 *
 * @author ChunchO
 */
public class Problem048 {
	public static void main(String[] args){
		BigInteger suma = BigInteger.ZERO;
		for(int i = 1;i<=1000;i++){
			suma = suma.add(BigInteger.valueOf(i).pow(i));
		}
		System.out.println(suma.toString().substring(suma.toString().length()-10, suma.toString().length()));
	}
}
